Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.

Embedded WebExtension - #11760

Closed
Hainish wants to merge 11 commits into
EFForg:masterfrom
Hainish:embedded-webextension
Closed

Hainish wants to merge 11 commits into
EFForg:masterfrom
Hainish:embedded-webextension

Conversation

@Hainish

@Hainish Hainish commented Aug 8, 2017

Copy link
Copy Markdown
Member

This PR, superseding #11639 and resolving #10007, migrates settings from the legacy XPCOM codebase to a new, Embedded WebExtensions codebase. This includes:

  • High-level preferences: Whether HTTPS Everywhere is disabled, whether HTTP requests are allowed, if a counter should be displayed
  • Which rulesets are manually enabled/disabled
  • Any custom rulesets which are housed in HTTPSEverywhereCustomUserRules

In addition, this includes various fixes to the functionality of the WebExtensions code to make it work gracefully in Firefox, cherry-picked from the webextensions branch.

Embedded webextensions will be deprecated as of Firefox 57 as well, so this is merely an intermediate step to enable us to have users' settings migrated.

Additionally, this includes a new options ui to allow users to import a json file with settings. Since this replaces #11639, there will be no way for users to export previous settings yet. This won't be a problem, since Embedded WebExtensions are able to transfer settings automatically via the runtime.sendMessage API.

@Hainish Hainish mentioned this pull request Aug 8, 2017
@Hainish
Hainish force-pushed the embedded-webextension branch from 856656a to d190662 Compare August 8, 2017 22:11
@Hainish
Hainish force-pushed the embedded-webextension branch from d190662 to 48d8d3e Compare August 8, 2017 22:38
@Hainish Hainish changed the title WIP: Embedded webextension Embedded webextension Aug 9, 2017
@Hainish Hainish changed the title Embedded webextension Embedded WebExtension Aug 9, 2017
@Hainish

Hainish commented Aug 9, 2017

Copy link
Copy Markdown
Member Author

In order to maximize the window of time users are given to restart their browsers and have their settings migrated (#11639 (comment)) I'd like to merge this in as soon as possible, and issue a release of the Embedded WebExtension early next week.

@ghost

ghost commented Aug 9, 2017

Copy link
Copy Markdown

@Hainish I hope you didn't sacrifice testing to make this come out earlier?

@Hainish

Hainish commented Aug 9, 2017

Copy link
Copy Markdown
Member Author

@koops76 I've been testing all along, but there are bound to be edge cases. Any beta-testers that that want to install this are welcome to, but this combines the work over many months of enumerating bugs in the Firefox WebExtension code and pushing out fixes. What's new in this PR is the migration code as well as the XPCOM wrapper.

@Hainish

Hainish commented Aug 9, 2017 via email

Copy link
Copy Markdown
Member Author

@jsha

jsha commented Aug 9, 2017

Copy link
Copy Markdown
Member

In addition, this includes various fixes to the functionality of the WebExtensions code to make it work gracefully in Firefox,

These should be in a separate PR.

@jsha

jsha commented Aug 9, 2017

Copy link
Copy Markdown
Member

I've changed the Firefox tests to use Selenium just as the Chrome tests do.

This should also be a separate PR.

@Bisaloo

Bisaloo commented Aug 9, 2017

Copy link
Copy Markdown
Collaborator

@Hainish, I'm sorry, I'm not sure how to test this.

I checked out to your branch and ran bash makexpi.sh which exited just fine but Firefox is telling me "This add-on could not be installed because it appears to be corrupt."

What am I doing wrong?

@ghost

ghost commented Aug 9, 2017

Copy link
Copy Markdown

@Bisaloo Probably a signature issue.

@gloomy-ghost

Copy link
Copy Markdown
Collaborator

@Bisaloo You can disable the signature checking by toggling xpinstall.signatures.required, however this option only works for Nightly.

@J0WI

J0WI commented Aug 9, 2017

Copy link
Copy Markdown
Contributor

You can disable the signature checking by toggling xpinstall.signatures.required, however this option only works for Nightly.

You should use an old Nightly Build for this, because they are already removing XPCOM support from current Nightlies (57.0a1).

@jsha jsha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial comments, haven't reviewed everything yet.

Comment thread chromium/background.js

// Send a message to the embedded webextension bootstrap.js to get settings to import
chrome.runtime.sendMessage("import-legacy-data", function(settings){
import_settings(settings);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just provide import_settings directly as the callback parameter to sendMessage, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #11792

Comment thread chromium/background.js
});

/**
* Enable switch planner for specific tab

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #11792

Comment thread chromium/background.js
for(let ruleset of settings.custom_rulesets){
all_rules.addFromXml((new DOMParser()).parseFromString(ruleset, 'text/xml'));
}
storage.set({"legacy_custom_rulesets": settings.custom_rulesets}, item => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, no need to define a closure here, just pass resolve as the callback.

Why store this under "legacy_custom_rulesets" rather than store the rulesets in the same way as the other custom rulesets? That way we could just call the appropriate function to load all custom rulesets when we're done, eliminating a possible edge case.

@Hainish Hainish Aug 9, 2017 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsha the other custom rulesets are specially formatted objects that do not allow specifying, for instance, exclusions. Here is one example:

[{"host":"example.com","redirectTo":"https://example.com/","urlMatcher":"^http://example\\.com/"}]

This was never in XML format, since it is added via the WebExtensions UI. From that format, a RuleSet object is created. This format, notably, does not in its current form support exclusions & securecookies. We'd have to build support for that, as well as code that converts XML to the custom_rule format. I'm not against doing this, but it seems like the job for a future migration.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removal of closure resolved in #11792

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable on the custom rulesets vs XML thing.

@Hainish

Hainish commented Aug 9, 2017

Copy link
Copy Markdown
Member Author

PR split into 3 distinct PRs: #11789, #11791, #11792

@Hainish Hainish closed this Aug 9, 2017
@ghost

ghost commented Aug 11, 2017

Copy link
Copy Markdown

@J0WI Move to "Done" please.

@Hainish

Hainish commented Aug 11, 2017

Copy link
Copy Markdown
Member Author

This PR wasn't merged so I'll just remove it from the board

@Hainish
Hainish deleted the embedded-webextension branch February 23, 2018 01:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants